import request from '@/utils/axios'

export interface LoginLogType {
  id: number
  username: string
  userIp: string
  agent: string
  type: number
  result: number
  create_time?: Date
}

export interface LoginLogPageReqType extends PageParam {
  username?: string
  userIp?: string
  create_time?: Date[]
}

export interface LoginLogExportReqType {
  username?: string
  userIp?: string
  create_time?: Date[]
}

export interface LoginLogPageRepType extends PageResponse {
  list: LoginLogType[]
}

/**
 * 登录日志接口
 */
export const LoginLogApi = {
  // 查询分页列表
  page: (params: LoginLogPageReqType): Promise<LoginLogPageRepType> => {
    return request.get({ url: '/system/login-log/page', params, is_mock: true })
  },
  // 导出
  export: (params: LoginLogExportReqType): Promise<LoginLogType[]> => {
    return request.get({ url: '/system/login-log/export', params, is_mock: true })
  }
}
